/**
 * Copyright &copy; 2018 thinkis All rights reserved.
 */
package com.thinkis.modules.edu.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkis.common.persistence.Page;
import com.thinkis.common.service.CrudService;
import com.thinkis.modules.edu.entity.EnrollList;
import com.thinkis.modules.edu.dao.EnrollListDao;

/**
 * 报名名单Service
 * @author liuzhiping
 * @version 2018-08-18
 */
@Service
@Transactional(readOnly = true)
public class EnrollListService extends CrudService<EnrollListDao, EnrollList> {

	public EnrollList get(String id) {
		return super.get(id);
	}
	
	public List<EnrollList> findList(EnrollList enrollList) {
		return super.findList(enrollList);
	}
	
	public Page<EnrollList> findPage(Page<EnrollList> page, EnrollList enrollList) {
		return super.findPage(page, enrollList);
	}
	
	@Transactional(readOnly = false)
	public void save(EnrollList enrollList) {
		super.save(enrollList);
	}
	
	@Transactional(readOnly = false)
	public void delete(EnrollList enrollList) {
		super.delete(enrollList);
	}
	
	@Transactional(readOnly = false)
	public int batchDelete(String selectedIds){
		int success = 0;
		try{
			String[] ids = selectedIds.split(",");
			for(String id : ids){
				EnrollList enrollList = new EnrollList();
				enrollList.setId(id);
				super.delete(enrollList);
				success++;
			}
		}catch(Exception e){
			logger.error("数据删除失败");
			return success;
		}
		return success;
	}
	
}